home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 13.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-08-07  |  12.8 KB  |  571 lines

  1. /*
  2.                                  Visual FX
  3.                                     For
  4.                                  Image FX
  5.                                SetUp Script
  6.                            Written By J.L. White
  7.  
  8.                          (C)1997 Merlin's Software
  9.  
  10. */
  11.  
  12. parse arg Num Frames
  13. options results
  14. address "IMAGEFX.1"
  15. ReDraw On
  16. Quotes = '22'X
  17.  
  18.     RequestResponse "Do You Need Instructions?"
  19.     if rc = 0 then do
  20.         call Docs()
  21.         end    
  22.  
  23. if exists("libs:flyer.library") then do
  24.     if (POS('PROJECT_REXX_PORT',SHOW('Ports')) =0) then do
  25.         RequestNotify 'Flyer Must Be Running First!'
  26.         exit
  27.         end
  28.     call OpenFlyStuff()
  29.  
  30.  
  31.     Gadget.1 = 'D/132/22/120/Base Image Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  32.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  33.     if rc ~= 0 then do
  34.         call CloseStuff()
  35.         exit 0
  36.         end
  37.     else do
  38.         IAType = RESULT.1
  39.            end
  40.  
  41.     call GetA()
  42. end
  43. else do
  44.     Gadget.1 = 'D/132/22/120/Base Image Type/2/FRAME/SEQUENCE'
  45.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  46.     if rc ~= 0 then do
  47.         call CloseStuff()
  48.         exit 0
  49.         end
  50.     else do
  51.         IAType = RESULT.1+2
  52.            end
  53.  
  54.     call GetA()
  55. end
  56.  
  57.  
  58.  
  59.     RequestNumber '"Enter Number Of Images To Add!"' 1
  60.     CompTotal = result
  61.  
  62.     call LoadA()
  63.  
  64.     do i = 1 to CompTotal
  65.  
  66.  
  67.         if exists("libs:flyer.library") then do
  68.  
  69.             Gadget.1 = 'D/127/22/120/Image #'right(i,2,'0')' Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  70.             ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  71.             if rc ~= 0 then do
  72.                 call CloseStuff()
  73.                 exit 0
  74.                 end
  75.             else do
  76.                 IAType.i = RESULT.1
  77.                    end
  78.  
  79.             call GetALL()
  80.         end
  81.         else do
  82.             if i = 1 then DriveName = "RAM:"
  83.             else DriveName = GetPathName(PicName.i-1)
  84.             Gadget.1 = 'D/127/22/120/Image #'right(i,2,'0')' Type/2/FRAME/SEQUENCE'
  85.             ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  86.             if rc ~= 0 then do
  87.                 call CloseStuff()
  88.                 exit 0
  89.                 end
  90.             else do
  91.                 IAType.i = RESULT.1+2
  92.                    end
  93.         
  94.             call GetALL()
  95.         end
  96.  
  97.         NumA = 1
  98.         NumB = 100
  99.         NumC = 75
  100.         RequestSlider '"Enter Amount To Blend Image!"' NumA NumB NumC
  101.         Blend.i = result
  102.  
  103.         RequestSlider '"Enter Amount To Feather Edges!"' 0 50 25
  104.         FeatherNum.i = Result
  105.  
  106.  
  107.         Gadget.1 = ' Select Drawing Tool To Use! '
  108.         Gadget.2 = ' Rectangle '
  109.         Gadget.3 = ' Oval '
  110.         Gadget.4 = ' Free Hand '
  111.         ListRequest 4 Gadget
  112.         DrawType.i = 0
  113.         if result = 2 then DrawType.i = 0
  114.         if result = 3 then DrawType.i = 1
  115.         if result = 4 then DrawType.i = 2
  116.         call LoadAll()
  117.  
  118.         if DrawType.i = 0 then call PickBox()
  119.         if DrawType.i = 1 then call PickCircle()
  120.         if DrawType.i = 2 then call PickFree()
  121.  
  122.         Gadget.1 = ' Select Entry Mode! '
  123.         Gadget.2 = ' ON From Start '
  124.         Gadget.3 = ' Fade In '
  125.         ListRequest 3 Gadget
  126.         InType.i = 0
  127.         if result = 2 then InType.i = 0
  128.         if result = 3 then InType.i = 1
  129.  
  130.         FadeIn.i = 0
  131.         if InType.i = 1 then do
  132.             FNum = ((End-Start)+1)%4
  133.             if FNum > 30 then FNum = 30
  134.             RequestSlider '"Enter Amount Of Frames To Fade In!"' 1 (End-Start)+1 FNum
  135.             FadeIn.i = Result
  136.             end
  137.  
  138.  
  139.         Gadget.1 = ' Select Exit Mode! '
  140.         Gadget.2 = ' ON To End '
  141.         Gadget.3 = ' Fade Out '
  142.         ListRequest 3 Gadget
  143.         OutType.i = 0
  144.         if result = 2 then OutType.i = 0
  145.         if result = 3 then OutType.i = 1
  146.  
  147.         FadeOut.i = 0
  148.         if OutType.i = 1 then do
  149.             FNum = ((End-Start)+1)%4
  150.             if FNum > 30 then FNum = 30
  151.             RequestSlider '"Enter Amount Of Frames To Fade Out!"' 1 (End-Start)+1 FNum
  152.             FadeOut.i = Result
  153.             end
  154.  
  155.  
  156.     end
  157.  
  158. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  159. call writeln TempFile,PicAName
  160. call writeln TempFile,Start
  161. call writeln TempFile,End
  162. call writeln TempFile,IAType
  163. call writeln TempFile,CompTotal
  164. do i = 1 to CompTotal
  165.     call writeln TempFile,PicName.i
  166.     call writeln TempFile,Start.i
  167.     call writeln TempFile,End.i
  168.     call writeln TempFile,IAType.i
  169.     call writeln TempFile,Blend.i
  170.     call writeln TempFile,InType.i
  171.     call writeln TempFile,OutType.i
  172.     call writeln TempFile,FadeIn.i
  173.     call writeln TempFile,FadeOut.i
  174.     call writeln TempFile,FeatherNum.i
  175.     call writeln TempFile,DrawType.i
  176.     call writeln TempFile,DrawAnswer.i
  177.     end
  178.  
  179. call close TempFile
  180.  
  181. ActiveColor 1
  182.  
  183. if FlyOn = 1 then
  184.     call CloseStuff()
  185.  
  186.  
  187. exit
  188.  
  189.  
  190.  
  191. GetFile:
  192.     parse Arg Title, Path
  193.     Address FLY_1 SetString Path
  194.     Address FLY_1 GetFileNameNT Title
  195. return result
  196.  
  197. GetFileName: procedure  
  198.    ARG CompleteName
  199.    c = lastpos("/",CompleteName)
  200.    if c = 0 then c = lastpos(":",CompleteName)
  201.    return substr(CompleteName, c + 1)
  202.  
  203. GetPathName: procedure  
  204.    ARG CompleteName
  205.    c = lastpos("/",CompleteName)
  206.    if c = 0 then c = lastpos(":",CompleteName)
  207.    return left(CompleteName,c)
  208.  
  209.  
  210. GetA:
  211.  if IAType = 0 then do
  212.     call Switcher(TOSW)
  213.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  214.     Name = GetFileName(PicAName)
  215.     if Name = "" then do
  216.         Address FLY_1 OK_TEXT " OK "
  217.         Title = "You Must Enter A Valid Clip Name To Use!"
  218.         Address FLY_1 FYINT Title
  219.         Address FLY_1 Quit
  220.         call Switcher(TOWB)
  221.         exit
  222.         end
  223.     Address FLY_1 SetFileName PicAName
  224.     Address FLY_1 GetClipLength PicAName
  225.     End = result
  226.     Start = 0
  227.     Address FLY_1 Program "5"
  228.     Address FLY_1 StartNum Start
  229.     Address FLY_1 EndNum End
  230.     Address FLY_1 CurrentNum "0"
  231.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  232.     Start = word(result,1)*2
  233.     End = word(result,2)*2
  234.     Start  = Start + 1
  235.     End = End +2
  236.     call addlib('PROJECT_REXX_PORT' , 0)
  237.     call addlib(TOASTERLIB,0)
  238.     call Switcher(TOWB)
  239.     address command "C:Wait 1"
  240.     ScreenToFront
  241.     end
  242.    if IAType = 1 then do
  243.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  244.     PicAName = result
  245.     Name = GetFileName(PicAName)
  246.     if Name = "" then do
  247.         Title = "You Must Enter A Valid Name To Use!"
  248.         RequestNotify Title
  249.         if FlyOn = 1 then Address FLY_1 Quit
  250.         exit
  251.         end
  252.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  253.     End = result
  254.     Start = 1
  255.     end
  256.    if IAType = 2 then do
  257.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  258.     PicAName = result
  259.     DriveName = GetPathName(PicName)
  260.     Name = GetFileName(PicAName)
  261.     if Name = "" then do
  262.         Title = "You Must Enter A Valid Name To Use!"
  263.         RequestNotify Title
  264.         if FlyOn = 1 then Address FLY_1 Quit
  265.         exit
  266.         end
  267.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  268.     End = result
  269.     Start = 1
  270.     end
  271.    if IAType = 3 then do
  272.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  273.     PicAName = result
  274.     DriveName = GetPathName(PicName)
  275.     Name = GetFileName(PicAName)
  276.     if Name = "" then do
  277.         Title = "You Must Enter A Valid Name To Use!"
  278.         RequestNotify Title
  279.         if FlyOn = 1 then Address FLY_1 Quit
  280.         exit
  281.         end
  282.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  283.     End = result
  284.     Start = 1
  285.     end
  286. return
  287.  
  288.  
  289.  
  290. GetAll:
  291.  if IAType.i = 0 then do
  292.     call Switcher(TOSW)
  293.     PicName.i = GetFile("Select Flyer Clip For Image #"i+1"  ",DriveName)
  294.     Name = GetFileName(PicName.i)
  295.     if Name = "" then do
  296.         Address FLY_1 OK_TEXT " OK "
  297.         Title = "You Must Enter A Valid Clip Name To Use!"
  298.         Address FLY_1 FYINT Title
  299.         Address FLY_1 Quit
  300.         call Switcher(TOWB)
  301.         exit
  302.         end
  303.     Address FLY_1 SetFileName PicName.i
  304.     Address FLY_1 GetClipLength PicName.i
  305.     End.i = result
  306.     Start.i = 0
  307.     Address FLY_1 Program "5"
  308.     Address FLY_1 StartNum Start.i
  309.     Address FLY_1 EndNum End.i
  310.     Address FLY_1 CurrentNum "-1"
  311.     Address FLY_1 GetTimeNT "Select Frame To Start With For Image #"i+1"  "
  312.     Start.i = word(result,1)*2
  313.     End.i = word(result,2)*2
  314.     Start.i  = Start.i + 1
  315.     End.i = End.i +2
  316.  
  317.     call addlib('PROJECT_REXX_PORT' , 0)
  318.     call addlib(TOASTERLIB,0)
  319.     call Switcher(TOWB)
  320.     address command "C:Wait 1"
  321.     ScreenToFront
  322.     end
  323.    if IAType.i = 1 then do
  324.     Title = Quotes"Select Flyer Still For Image #"i+1"  "Quotes
  325.     RequestFile Title DriveName ' '
  326.     PicName.i = result
  327.     Name = GetFileName(PicName.i)
  328.     if Name = "" then do
  329.         Title = "You Must Enter A Valid Name To Use!"
  330.         RequestNotify Title
  331.         if FlyOn = 1 then Address FLY_1 Quit
  332.         exit
  333.         end
  334.     End.i = 1
  335.     Start.i = 1
  336.     end
  337.    if IAType.i = 2 then do
  338.     if i = 1 then DriveName = "SYS:"
  339.     Title = Quotes"Select FileName For Image #"i+1"  "Quotes
  340.     RequestFile Title DriveName ' '
  341.     PicName.i = result
  342.     if i > 0 then DriveName = GetPathName(PicName.i)
  343.     Name = GetFileName(PicName.i)
  344.     if Name = "" then do
  345.         Title = "You Must Enter A Valid Name To Use!"
  346.         RequestNotify Title
  347.         if FlyOn = 1 then Address FLY_1 Quit
  348.         exit
  349.         end
  350.     End.i = 1
  351.     Start.i = 1
  352.     end
  353.    if IAType.i = 3 then do
  354.     if i = 1 then DriveName = "SYS:"
  355.     Title = Quotes"Select BaseName For Image #"i+1"  "Quotes
  356.     RequestFile Title DriveName ' '
  357.     PicName.i = result
  358.     if i > 0 then DriveName = GetPathName(PicName.i)
  359.     Name = GetFileName(PicName.i)
  360.     if Name = "" then do
  361.         Title = "You Must Enter A Valid Name To Use!"
  362.         RequestNotify Title
  363.         if FlyOn = 1 then Address FLY_1 Quit
  364.         exit
  365.         end
  366.     RequestNumber '"Enter Number Of Frames To Process!"' (End-Start)+1
  367.     End.i = result
  368.     Start.i = 1
  369.     end
  370. return
  371.  
  372. CloseStuff:
  373.     Address FLY_1 Quit
  374.     call remlib('ToasterARexx.port')
  375.     call remlib('PROJECT_REXX_PORT')
  376. return
  377.  
  378.  
  379. OpenFlyStuff:
  380.     FlyOn = 1
  381.     address command "run VFXIFX:FLY" 
  382.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  383.         address command "wait 1"
  384.         end
  385.     TOASTERLIB="ToasterARexx.port"
  386.     call remlib('ToasterARexx.port')
  387.     call remlib('PROJECT_REXX_PORT')
  388.     call addlib('PROJECT_REXX_PORT' , 0)
  389.     call addlib(TOASTERLIB,0)
  390.     DriveName = FindDrive()
  391. return
  392.  
  393.  
  394. FindDrive:
  395.     address command "C:Info >RAM:DriveList"
  396.     call open TempFile,"RAM:DriveList",R
  397.     do until eof(TempFile)
  398.         line = readln(TempFile)
  399.         parse var line Drive" "Rest
  400.         if Drive = "FA0:" then 
  401.             FlyVolume = word(Rest,7)":"
  402.     end
  403.     call close TempFile
  404.     address command "Delete >NIL: RAM:DriveList"
  405. return FlyVolume
  406.  
  407.  
  408.  
  409. LoadA:
  410.     if IAType = 0 then do
  411.         LoadBuffer PicAName Force Start
  412.         end
  413.     if IAType = 1 then do
  414.         LoadBuffer PicAName Force 1
  415.         end
  416.     if IAType = 2 then do
  417.         LoadBuffer PicAName Force
  418.         end
  419.     if IAType = 3 then do
  420.         LoadBuffer PicAName""right(Start,3,'0') Force
  421.         end
  422.     GetMain
  423.     parse var result Name Width Height Blah
  424. return
  425.  
  426.  
  427.  
  428.  
  429. LoadAll:
  430.     if IAType.i = 0 then do
  431.         LoadBuffer PicName.i Force Start.i
  432.         end
  433.     if IAType.i = 1 then do
  434.         LoadBuffer PicName.i Force 1
  435.         end
  436.     if IAType.i = 2 then do
  437.         LoadBuffer PicName.i Force
  438.         end
  439.     if IAType.i = 3 then do
  440.         LoadBuffer PicName""right(Start.i,3,'0') Force
  441.         end
  442.     Scale Width Height
  443. return
  444.  
  445.  
  446.  
  447. PickBox:
  448.     KillBrush
  449.     Menu ToolBox
  450.     RequestNotify "Draw Rectangle Where You Want New Image Placed!"
  451.     DrawTool Box
  452.     HidePanel
  453.     Undo On
  454.     WaitFor SELECTDOWN
  455.     parse var result X1 Y1
  456.     WaitFor SELECTUP
  457.     parse var result X2 Y2
  458.     Undo
  459.     ShowPanel
  460.     Undo Off
  461.     X1 = strip(X1)
  462.     Y1 = strip(Y1)
  463.     X2 = strip(X2)-X1
  464.     Y2 = strip(Y2)-Y1
  465.     RequestResponse "Is The Box You Selected Correct?"
  466.     if rc ~= 0 then call PickBox()
  467.  
  468.     DrawAnswer.i = X1" "Y1" "X2" "Y2
  469.  
  470. return
  471.  
  472.  
  473.  
  474. PickCircle:
  475.     KillBrush
  476.     Menu ToolBox
  477.     RequestNotify "Draw Circle Where Image Will Show Through!"
  478.     DrawTool Oval
  479.     HidePanel
  480.     Undo On
  481.     WaitFor SELECTDOWN
  482.     parse var result X1 Y1
  483.     WaitFor SELECTUP
  484.     parse var result X2 Y2
  485.     Undo
  486.     ShowPanel
  487.     Undo Off
  488.     X1 = strip(X1)
  489.     Y1 = strip(Y1)
  490.     X2 = strip(X2)-X1
  491.     Y2 = strip(Y2)-Y1
  492.     RequestResponse "Is The Circle You Selected Correct?"
  493.     if rc ~= 0 then call PickCircle()
  494.  
  495.     DrawAnswer.i = X1" "Y1" "X2" "Y2
  496.  
  497. return
  498.  
  499.  
  500.  
  501. PickFree:
  502.     KillBrush
  503.     Menu ToolBox
  504.     DrawTool "FreeLine"
  505.     RequestNotify "Draw Area Where Image Will Show Through!"
  506.     HidePanel
  507.     Undo On
  508.     WaitFor SELECTDOWN
  509.     Learn "RAM:FreeDraw" NoHeader Quiet Force
  510.     WaitFor SELECTUP
  511.     Learn Stop Quiet Force
  512.     Undo
  513.     ShowPanel
  514.     Undo Off
  515.     RequestResponse "Is The Area You Have Drawn Correct?"
  516.     if rc ~= 0 then call PickFree()
  517.     CountNum = 0
  518.     call open TempFile,"Ram:FreeDraw.ifx",R
  519.     call open TempFile2,"VFXIFX:TempDrawer/DrawNum."left(Num,2,'')"."right(i,2,'0'),W
  520.     line = readln(TempFile)
  521.     line = readln(TempFile)
  522.     line = readln(TempFile)
  523.     line = readln(TempFile)
  524.     line = readln(TempFile)
  525.     line = readln(TempFile)
  526.     do until eof(TempFile)
  527.         DoIt = readln(TempFile)
  528.         if DoIt = "FreeDraw" then leave
  529.         parse var DoIt Name" "Nums
  530.         call writeln TempFile2,Nums
  531.         CountNum = CountNum + 1
  532.         end
  533.     call close TempFile
  534.     call close TempFile2
  535.     Answer.FNum = right(CountNum,3,'0')
  536.     address command "Delete >NIL: RAM:FreeDraw.ifx"
  537.     DrawAnswer.i = "VFXIFX:TempDrawer/DrawNum."left(Num,2,'')"."right(i,2,'0')
  538. return
  539.  
  540.  
  541.  
  542. Docs:
  543.  
  544.     text1 = '"This effect takes an image, sequence, or clip then"'
  545.     text2 = '"composites as many other images, sequences or clips"'
  546.     text3 = '"as you desire, on top of the base image."'
  547.     text4 = '" "'
  548.     text5 = '"Where Multi Layer fills the entire screen with the"'
  549.     text6 = '"other images, this lets you define where the other"'
  550.     text7 = '"images will show through and allows you to feather"'
  551.     text8 = '"the edges. The images will not be resized, they will"'
  552.     text9 = '"just show through the front. You will also have the"'
  553.     text10 = '"option to fade each image In & Out."'
  554.  
  555.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  556.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  557.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  558.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  559.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  560.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  561.     Gadget.7  = 'TEXT LE=10 TE=64 LB='text7' '
  562.     Gadget.8  = 'TEXT LE=10 TE=74 LB='text8' '
  563.     Gadget.9  = 'TEXT LE=10 TE=84 LB='text9' '
  564.     Gadget.10  = 'TEXT LE=10 TE=94 LB='text10' '
  565.     Gadget.11 = 'END'
  566.     NewComplexRequest  '"Instructions For Effect #13"' Gadget 380 106
  567.  
  568.  
  569. return
  570.  
  571.